﻿using Autofac;
using MahApps.Metro.Controls;
using PLC.Interface.Groups;
using PLCWpfTest.Common;
using PLCWpfTest.ViewModels;
using YWM;

namespace PLCWpfTest.Views
{
    /// <summary>
    /// GroupOperationWindow.xaml 的交互逻辑
    /// </summary>
    public partial class GroupOperationWindow : MetroWindow
    {
        public GroupOperationWindow(GroupDto group)
        {
            InitializeComponent();
            GroupOperationViewModel groupOperationViewModel = YApp.Resolve<GroupOperationViewModel>(new NamedParameter(Constant.DTO_GROUP, group));
            groupOperationViewModel.RequestClose += GroupOperationViewModel_RequestClose;
            DataContext = groupOperationViewModel;
        }

        private void GroupOperationViewModel_RequestClose()
        {
            DialogResult = true;
            Close();
        }
    }
}
